(function(my){
	if(!Tools){console.log('missing include ServerActions.js for class Tools'); return;}
	function ToolsCookie(name, val)
	{
		this.name = name;
		if(val)
		{
			/*
			var Days = 30;
			var exp = new Date();
			exp.setTime(exp.getTime() + Days*24*60*60*1000);
			document.cookie = name + "="+ escape (val) + ";expires=" + exp.toGMTString();
			*/
			localStorage.setItem(name ,val);
		}
	}
	ToolsCookie.prototype.toString = function(){	
		/*	
		var arr,reg=new RegExp("(^| )"+this.name+"=([^;]*)(;|$)");
		if(arr=document.cookie.match(reg))
			return unescape(arr[2]);
		else
			return null;		
		*/
		return localStorage.getItem(this.name);
	}
	ToolsCookie.prototype.remove = function(){
		var exp = new Date();
		exp.setTime(exp.getTime() - 1);
		var cval='';
		document.cookie= this.name + "="+cval+";expires="+exp.toGMTString();
	}
	
	my.ToolsCookie = ToolsCookie;
	
	my.Tools.prototype.cookie = function(name, val){
		if(val)
			return new ToolsCookie(name, val);
		else
			return new ToolsCookie(name);
	};
	my.Tools.prototype.error = function(data){
		if(!data)
		{
			throw('data not valid');
		}
		if(data.errorCode <=0)
		{
			throw('error:' + JSON.stringify(data));
		}
	};
	my.tool = new Tools;
})(this);